/// 
/// Author: Jeff Liu
/// Date: 2022-03-16 15:13:25
/// LastEditTime: 2023-06-05 19:47:07
/// LastEditors: Jeff Liu
/// Description: 
/// FilePath: /HCCBJ/src/cls/Deploy/Util.cls
/// Jeff.liu@intersytems.com
/// 
Class Deploy.Util Extends %RegisteredObject
{

ClassMethod MakeDeployment(path) As %Status
{
	set p=##class(%Studio.Project).%New()
    do p.AddItem("WS.DE.Tools.cls")
    do p.AddItem("HIP.DataGov.Util.cls")
    do p.AddItem("HCC.Util.cls")
    set tsc= p.DeployToFile(path_"HCC_Deployed_Classes.xml",,1) 
    
    do $System.OBJ.Export("WS*.GBL",path_"WS.xml")

    do $System.OBJ.Export("HCC.GBL",path_"HCC.xml")  

    do $System.OBJ.Export("HCC.SVR.PubSub*.GBL",path_"PubSub.xml")  
     do $System.OBJ.Export("HCC.DocTemplate*.GBL",path_"HCCDocTemplate.xml")  
    w tsc
    
    quit tsc
}

/// import deployed
ClassMethod ImportDeployed(path) As %Status
{
    Set sc = $$$OK
    set sc = ##class(%Studio.Project).InstallFromFile(path_"HCC_Deployed_Classes.xml")
    Return sc
}

// import global

/// Description:
ClassMethod ImportGlobal() As %Status
{
    Set sc = $$$OK
    // do something
    Return sc
}

/// 导出zpm使用的 global xml格式
ClassMethod GlobalExport(pPath As %String) As %Status
{
   do $System.OBJ.Export("WS*.GBL",pPath_"WS.xml")

   do $System.OBJ.Export("HCC.GBL",pPath_"HCC.xml")
   
   quit $$$OK
}

/// deploy mode after zpm compile
ClassMethod Deploy() As %Status
{
    Set sc = $$$OK
    d $system.OBJ.MakeClassDeployed("WS.DE.Tools")
    d $system.OBJ.MakeClassDeployed("HIP.DataGov.Util")
    d $system.OBJ.MakeClassDeployed("HCC.Util")
    Return sc
}

}
